﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SuperFox.SuperServiceReference;

namespace SuperFox
{
    public class TreeViewItemExtension : TreeViewItem
    {
        // add some props

        public int ID { get; set; }

        public DbHelp HelpItem { get; set; }

        public bool IsLoaded { get; set; }

        public TreeViewItemExtension()
        {
            ID = -1;
        }

        public bool ContainsHelpItem(DbHelp item)
        {
            if (this.Items == null)
                return false;

            bool ok = false;

            foreach (TreeViewItemExtension tv in this.Items)
            {
                if (tv.HelpItem == null)
                    continue;

                if (tv.HelpItem.index == item.index)
                    ok = true;
            }

            return ok;
        }



        //public override bool Equals(object obj)
        //{
        //    return base.Equals(obj);
        //}


        //public override bool Equals(object obj)
        //{
        //    TreeViewItemExtension objHelpItem = (obj as TreeViewItemExtension);

        //    if (objHelpItem == null)
        //        return false;

        //    if (this.HelpItem == null || objHelpItem.HelpItem == null)
        //    {
        //        return false;
        //    }
        //    else
        //    {
        //        return this.HelpItem.index == objHelpItem.HelpItem.index;
        //    }
        //}

        //public override int GetHashCode()
        //{
        //    if (this.HelpItem == null)
        //    {
        //        return base.GetHashCode();
        //    }
        //    else
        //    {

        //        return this.HelpItem.GetHashCode();
        //    }
        //}
    }

}
